<?php class intro extends Model {

    function __construct()
    {
        parent::__construct();
    }
    
    function insert(){
       $this->name = $_POST['name'];
       $this->add_time = $_POST['add_time'];
       $this->version = $_POST['version'];
       $this->level = $_POST['level'];
       $this->mod_id = $_POST['mod_id'];
       $this->count = $_POST['count'];
       $this->createtime = time();
       $result = $this->db->insert('intro',$this);
       return $result;
    }
    
    function select($id){
       if($id!=""){
       	  $this->db->where(array('intro_id'=>$id));
       }
       $query = $this->db->get('intro');
       $result = $query->result(); 
       return $result;
    }
    
    function update($id){
       $this->name = $_POST['name'];
       $this->add_time = $_POST['add_time'];
       $this->version = $_POST['version'];
       $this->level = $_POST['level'];
       $this->mod_id = $_POST['mod_id'];
       $this->count = $_POST['count'];
       $result = $this->db->update('intro',$this,array('intro_id'=>$id));
       return $result;
    }
    
    function del($id){
       $result = $this->db->delete('intro',array('intro_id'=>$id));
       return $result;
    }
}